package com.boot.producer.controller;

import com.boot.producer.service.GradeService;
import com.boot.producer.service.dto.GradeDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.mapstruct.Mapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
* FileName: GradeController.java
* 评分Controller
*
* @author 张志磊
* @date   2019/3/1 14:54
* @version 1.0
*/
@RestController
@RequestMapping("/grade")
@Api("评分")
public class GradeController {

    @Autowired
    GradeService gradeService;

    @ApiOperation("根据日期获取评分")
    @GetMapping("/get")
    @ResponseBody
    public GradeDto getGrade(@RequestParam("date") Date date){
        return gradeService.getGradeByDate(date);
    }
    @ApiOperation("根据日期获取评分")
    @GetMapping("/list")
    @ResponseBody
    public List<GradeDto> listOnweek(@RequestParam("begin") Date begin,@RequestParam("end") Date end){
        return gradeService.listOneWeek(begin,end);
    }
}
